﻿using System;
using System.Xml.Serialization;

namespace SpCop.Model
{
    [XmlRoot("Rule")]
    public class RuleDefinition
    {
        [XmlElement("Resolution")] 
        public NamedResolution[] Resolutions;
        
        public string Email { get; set; }

        public string FixCategories { get; set; }

        public string Owner { get; set; }

        public string TypeName { get; set; }

        public string Category { get; set; }

        public string Description { get; set; }

        public string LongDescription { get; set; }

        public string CheckId { get; set; }

        public string Name { get; set; }

        [XmlIgnore]
        public ProductVersion TargetVersions;


        [XmlElement("ProductVersion")]
        public string ProductVersion
        {
            get { return TargetVersions.ToString(); }
            set
            {
                var o = Enum.Parse(typeof(ProductVersion), value);
                if(o != null)
                TargetVersions = (ProductVersion)o;
            }
        }

        public MessageLevel MessageLevel { get; set; }
    }
}